\hypertarget{class_setting}{\section{Setting类 参考}
\label{class_setting}\index{Setting@{Setting}}
}


一个简单的配置类  




{\ttfamily \#include $<$Setting.\+h$>$}

\subsection*{Public 成员函数}
\begin{DoxyCompactItemize}
\item 
sint32 \hyperlink{class_setting_a0424a85686c67883161dd10ca5ed34ad}{open} (std\+::string file)
\begin{DoxyCompactList}\small\item\em 打开配置文件 \end{DoxyCompactList}\item 
std\+::string \hyperlink{class_setting_a44d1a33f5ed6330e09a0ae6c536b6a9c}{read} (std\+::string key)
\begin{DoxyCompactList}\small\item\em 读取配置项 \end{DoxyCompactList}\item 
sint32 \hyperlink{class_setting_a3c115982cf6bbb576a953a1384f0142b}{write} (std\+::string key, std\+::string value)
\begin{DoxyCompactList}\small\item\em 修改配置项 \end{DoxyCompactList}\item 
sint32 \hyperlink{class_setting_abad4f7885758e089a80030086a188b3b}{close} ()
\begin{DoxyCompactList}\small\item\em 关闭配置文件,此操作会重写并保存配置文件 \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{详细描述}
一个简单的配置类 

\subsection{成员函数说明}
\hypertarget{class_setting_abad4f7885758e089a80030086a188b3b}{\index{Setting@{Setting}!close@{close}}
\index{close@{close}!Setting@{Setting}}
\subsubsection[{close}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Setting\+::close (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}\label{class_setting_abad4f7885758e089a80030086a188b3b}


关闭配置文件,此操作会重写并保存配置文件 


\begin{DoxyParams}{参数}
{\em void} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_setting_a0424a85686c67883161dd10ca5ed34ad}{\index{Setting@{Setting}!open@{open}}
\index{open@{open}!Setting@{Setting}}
\subsubsection[{open}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Setting\+::open (
\begin{DoxyParamCaption}
\item[{std\+::string}]{file}
\end{DoxyParamCaption}
)}}\label{class_setting_a0424a85686c67883161dd10ca5ed34ad}


打开配置文件 


\begin{DoxyParams}{参数}
{\em file} & 配置文件名 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_setting_a44d1a33f5ed6330e09a0ae6c536b6a9c}{\index{Setting@{Setting}!read@{read}}
\index{read@{read}!Setting@{Setting}}
\subsubsection[{read}]{\setlength{\rightskip}{0pt plus 5cm}std\+::string Setting\+::read (
\begin{DoxyParamCaption}
\item[{std\+::string}]{key\+Str}
\end{DoxyParamCaption}
)}}\label{class_setting_a44d1a33f5ed6330e09a0ae6c536b6a9c}


读取配置项 


\begin{DoxyParams}{参数}
{\em key\+Str} & key名称 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回key对应的value字串,失败返回空字符串 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
none 
\end{DoxyNote}
\hypertarget{class_setting_a3c115982cf6bbb576a953a1384f0142b}{\index{Setting@{Setting}!write@{write}}
\index{write@{write}!Setting@{Setting}}
\subsubsection[{write}]{\setlength{\rightskip}{0pt plus 5cm}sint32 Setting\+::write (
\begin{DoxyParamCaption}
\item[{std\+::string}]{key\+Str, }
\item[{std\+::string}]{value\+Str}
\end{DoxyParamCaption}
)}}\label{class_setting_a3c115982cf6bbb576a953a1384f0142b}


修改配置项 


\begin{DoxyParams}{参数}
{\em key\+Str} & key名称 \\
\hline
{\em value\+Str} & value字符串 \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{返回}
成功返回\+S\+T\+A\+T\+U\+S\+\_\+\+O\+K,失败返回\+S\+T\+A\+T\+U\+S\+\_\+\+E\+R\+R\+O\+R 
\end{DoxyReturn}
\begin{DoxyNote}{注解}
修改配置项后并不立即写入文件中,而是要等待close时才写入 
\end{DoxyNote}


该类的文档由以下文件生成\+:\begin{DoxyCompactItemize}
\item 
libemb/inc/\hyperlink{_setting_8h}{Setting.\+h}\item 
libemb/src/Setting.\+cpp\end{DoxyCompactItemize}
